package com.zj.ssm.controller;

import com.zj.ssm.pojo.domain.query.NewsTypeQuery;
import com.zj.ssm.pojo.domain.vo.CategoryVO;
import com.zj.ssm.result.AjaxResult;
import com.zj.ssm.service.NewsTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wxr
 * @version 1.0
 * @date 2022/2/17 9:07
 */
@RestController
@RequestMapping("category")
public class NewsTypeController {
    @Autowired
    private NewsTypeService newsTypeService;

    @RequestMapping("queryType")
    public AjaxResult queryType(NewsTypeQuery newsTypeQuery){
        return newsTypeService.queryType(newsTypeQuery);
    }

    @RequestMapping("add")
    public AjaxResult add(CategoryVO categoryVO){
        return newsTypeService.add(categoryVO);
    }

    @RequestMapping("list")
    public  AjaxResult list(){
        return newsTypeService.list();
    }
    @RequestMapping("delete/{id}")
    public AjaxResult delete(@PathVariable("id") Integer id){
        return newsTypeService.delete(id);
    }

    @RequestMapping("get/{id}")
    public AjaxResult get(@PathVariable("id") Integer id){
        return newsTypeService.get(id);
    }

    @RequestMapping("update")
    public AjaxResult update(CategoryVO categoryVO){
        return newsTypeService.update(categoryVO);
    }


}


